<?php


namespace App\Services\Tools;

use App\Exceptions\BasicException;
use App\Jobs\QiPao\GeneralRoomJob;
use App\Repositories\Dynamic\DynamicBrowseRepository;
use App\Repositories\Dynamic\DynamicFollowRepository;
use App\Repositories\Dynamic\DynamicLikeRepository;
use Carbon\Carbon;
use App\Enums\RedisKeyEnum;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Redis;

class RandRoomService
{

    const RAND_ROOM_ID = 'room:randid';

    //设置缓存集合
    public static function setRandRoomId(array $roomIds)
    {
        self::delete();
        return Redis::SADD(self::RAND_ROOM_ID, $roomIds);
    }

    //移除指定roomid
    public static function popRoomId($roomId)
    {
        return Redis::SREM(self::RAND_ROOM_ID,$roomId);
    }

    //获取当前存在的集合
    public static function getRoomIds()
    {
        return Redis::SMEMBERS(self::RAND_ROOM_ID);
    }


    //删除集合
    public static function delete()
    {
        return Redis::del(self::RAND_ROOM_ID);
    }


}